#include <stdio.h>
#include <unistd.h>

int g_val = 100;

int main()
{
    //int g_val = 100;
    pid_t id = fork();
    while(1)
    {
        if(id == 0)
        {
            g_val+=10;
            printf("子: g_val的地址为:%p, g_val的值100修改为->:%d\n", &g_val, g_val);
            sleep(1);
        }
        else 
        {
            printf("父: g_val的地址为:%p, g_val的值为:%d\n", &g_val, g_val);
            sleep(1);
        }
    }

    return 0;
}
